#include "types.h"
#include "core.h"
#include <SDL.h>
#include <SDL_mixer.h>

using namespace std;

extern dSymbol *T;
extern dList *nil;
extern "C" void load_module ();

class dMusic : public dObject
{
 public:
  Mix_Music *music;
  dMusic (Mix_Music *music);
  ~dMusic ();
  string toString ();
};

class dMixChunk : public dObject
{
 public:
  dList *channels;
  Mix_Chunk *sample;
  dMixChunk (Mix_Chunk *sample);
  ~dMixChunk ();
  void addChannel (int c);
  string toString ();
};

dObject *dInitAudio (dList *args); // (init-audio rate channels chunksize)
dObject *dMix_allocatechannels (dList *args); // Calls int Mix_AllocateChannels (int numchans)

dObject *dMakeMusic (dList *args); // (make-music "file")
dObject *dPlayMusic (dList *args); // (play-music music seconds=0) OR (play-music "file" seconds=0)
dObject *dPauseMusic (dList *args); // (pause-music)
dObject *dStopMusic (dList *args); // (stop-music seconds=0)
dObject *dSetMusicVolume (dList *args); // (set-music-volume volume=128)

dObject *dMix_loadwav (dList *args); // Calls Mix_Chunk* Mix_LoadWAV (char* file)

// (play-sample sample seconds=0 channel=-1) OR (play-sample "file" seconds=0 channel=-1)
dObject *dMix_fadeinchannel (dList *args); // Calls int Mix_FadeInChannel (int channel, Mix_Chunk* chunk, int loops, int ms)

// (pause-sample sample) OR (pause-sample channel=-1)
dObject *dMix_togglepause (dList *args);
